import { Module } from "@nestjs/common";

@Module({
  providers: [
    {
      provide: "TOKEN11",
      useValue: "VALUE11",
    },
  ],
  exports: ["TOKEN11"],
})
export class DynamicModule {
  static forRoot(): DynamicModule {
    const providers = [
      {
        provide: "TOKEN",
        useValue: "VALUE",
      },
    ];

    return {
      module: DynamicModule,
      providers,
      exports: providers.map((provider) => (provider instanceof Function ? provider : provider.provide)),
    };
  }
}
